package com.zyh.system.message.controller;

import com.zyh.system.message.dao.impl.MessageDaoImpl;
import com.zyh.system.message.domain.Message;
import com.zyh.system.message.service.impl.MessageServiceImpl;

import java.text.ParseException;
import java.util.Queue;
import java.util.Scanner;

/**
 * @Author zyh
 * @Date 2024/7/31 18:20
 * @Description 留言版系统主界面
 */

public class MessageIndex {
    public static final Scanner INPUT = new Scanner(System.in);
    public static final MessageServiceImpl serviceImpl = new MessageServiceImpl();
    public static final Queue<Message> QUEUE = MessageDaoImpl.QUEUE;

    public static void main(String[] args) throws ParseException {
        while (true) {
            System.out.println("---欢迎登录留言板系统---");
            System.out.println("--------主菜单---------");
            System.out.println("1.查询留言");
            System.out.println("2.添加留言");
            System.out.println("3.退出留言");
            System.out.println("请选择：");
            int choice = INPUT.nextInt();
            switch (choice) {
                case 1://查询留言
                    serviceImpl.showMessage(QUEUE);
                    break;
                case 2://添加留言
                    serviceImpl.addMessage(QUEUE);
                    break;
                default:
                    System.out.println("系统退出！");
                    System.exit(0);
            }
        }
    }
}
